const { Transform } = require("stream");

// 读写可通信
class MyTransform extends Transform {
  constructor() {
    super();
  }

  _transform(chunk, enc, next) {
    this.push(chunk.toString().toUpperCase());
    next(null, chunk); // err 数据
  }
}

let a = new MyTransform();

a.write("a");
a.write("b");
a.end("c");

a.pipe(process.stdout);
